home *** CD-ROM | disk | FTP | other *** search
- Path: news.itmel.bhp.com.au!usenet
- From: Chris Kuan <kuan.chris.ch@bhp.com.au>
- Newsgroups: comp.lang.c++
- Subject: Help : RW Tools.h++, templates, libraries and linking
- Date: 7 Feb 1996 05:45:10 GMT
- Organization: BHP Information Technology
- Message-ID: <4f9e96$4rr@gossamer.itmel.bhp.com.au>
- NNTP-Posting-Host: 134.18.242.70
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.2N (Windows; I; 16bit)
-
- I'm using HP-UX A.09.05 on an HP/9000/735,
- HP C++ compiler A.03.65.
-
- I've got my own simple class C.
- All member data items are simply doubles or ints, and no member functions
- except default constructor, == and an overloaded << operator.
-
- I've got a class based on a Rogue Wave template :
- typedef RWHashDictionary<RWCString, C> Y
-
- These classes are declared in a header file 1.h
-
- Now, I have a .cpp file called 2.cpp, which includes 1.h, and
- defines a function called foo.
-
- I also have other code that includes 1.h.
- 2.cpp requires this other code.
- I compile 2.cpp and all these other files, and put them into a library.
-
- Now, I (obviously) have a header file called 2.h in which foo is declared, and a
- totally different .cpp file called 3.cpp which wants to use function foo.
- 2.h DOES NOT include 1.h, as the types Y and C do not need to be visible to
- the function prototype of foo contained in 2.h
-
- When I #include <2.h> within 3.cpp, with include and link paths all set up OK,
- the linker has problems.
-
- Here's where my lack of linker/compiler/C++ internals gets me.
-
- The linker has to create an intermediate template definition file, but
- it looks something like this :
-
- #include <rw/cstring.h> // this gets the definition of RWCString
-
- typedef RWHashDictionary<RWCString, X> _dummy_;
-
- The Problem : the linker cannot find the definition of X at this point.
- (note that there is no second #include line for the hash dictionary.) Linking
- therefore cannot be done.
-
- The workaround : put #include <1.h> in 2.h
-
- The question : why?
-
- email any suggestions.
- thanks.
- --
-
- ---/\/\----------------------------------------------------
- / / /\ Chris Kuan
- / / / \ Systems Integration Services
- / / / /\ \ BHP Information Technology, Wollongong Region
- \ \/ / / / Voice +61 42 75 5657 Fax +61 42 75 5500
- \ / / / e-mail kuan.chris.ch@bhp.com.au
- --\/\/\/---------------------------------------------------
-
-
-